@extends('layout.userinfo')
@section('content')
    <div class="profile-panel" role="main">
    <form class="avatar-form ng-scope ng-pristine ng-valid" id="photoForm" method="post" action="/photo" enctype="multipart/form-data" >
        {{csrf_field()}}
        <p><button class="btn-upload btn-lg">上传图片</button><input type="file" name="img" cropper-source="avatar" cropper-file-types="jpg,jpeg,png" avatar-file="" /> 支持小于2M的JPG和PNG图片</p>
        <div class="avatar-previewcontainer clearfix" style="height:500px">
            <div class="avatar-imgcontainer source ng-isolate-scope" cropper="avatar" cropper-context="cropContext">
                @if(!$res)
                    <img src="/upload/images/default.jpg" id="avatar_url"class="noavatar" alt="默认头像" />
                @else
                <img src="{{$res->photo}}" id="avatar_url"class="noavatar" alt="默认头像" />
                @endif
            </div>
        </div>
        <input type="submit" class="btn-submit btn-primary btn-lg" value="保存头像" onclick="doUpload()">
        <a class="btn-cancel btn-lg" ng-click="cancelImage()">取消</a>
    </form>
    <iframe name="avatar_target" frameborder="0"  class="avatar-postframe ng-scope" src="about:blank"></iframe>
</div>

@endsection
